package com.bj.zspace.cloud.product.controller;

import com.bj.zspace.cloud.model.product.Product;
import com.bj.zspace.cloud.product.service.ProductService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping(value = "/api/product")
@RestController
public class ProductController {

    @Resource
    private ProductService productService;

    @GetMapping(value = "/{id}")
    public Product getProduct(@PathVariable("id") Long productId, HttpServletRequest request) throws InterruptedException {
        log.info("token:{}", request.getHeader("x-token"));
        return productService.getProduct(productId);
    }

}
